package cn.zhou;

public class test5 {
    public static void main(String[] args) {
        int[] a = {100,500,90,60,80,700};
        int sum = 0;
        int max = a[0];
        int min = a[0];
        for (int i = 0; i < a.length; i++) {
            if (a[i]>max) {
                max = a[i];
            }else if (a[i]<min) {
                min = a[i];
            }
        }
        System.out.println("所有元素的最大值:"+max);
        System.out.println("所有元素的最小值:"+min);
        for (int i = 0; i < a.length; i++) {
            sum += a[i];
        }
        int avg = (sum-max-min)/(a.length-2);
        System.out.println("去掉最大值和最小值后的平均值:"+avg);
    }
}
